<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"      
	  xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      >
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Insert title here</title>
	</head>
	<body>
	<h:form>
		<h:commandLink value="REJESTRACJA" action="register" /><br/>
		<h:commandLink value="LOGOWANIE" action="login" /><br/>
		<h:commandLink value="WYLOGUJ" action="#{userLoginBean.logout()}"/><br/>
		<h:commandLink value="DODAJ OGLOSZENIE" action="addAdvertisement"/><br/>
		<h:commandLink value="EDYTUJ DANE" action="edit"/><br/>
		<h:commandLink value="MOJE OGLOSZENIA" action="myAdvertisements"/><br/>
		<h:commandLink value="SZUKAJ OGLOSZENIA" action="searchAdvertisements"/><br/>
		<h:commandLink value="SZUKAJ UZYTKOWNIKOW" action="searchUsers"/><br/>
		<h:commandLink value="LISTA KATEGORII" action="manageCat"/><br/>
		<h:commandLink value="LISTA TYPOW" action="manageType"/><br/>
		<h:outputText value="#{userLoginBean.loginStatus}"/><br/><br/>
		<!--  -->
		<h:dataTable value="#{displayAdvertisementsBean.get10AdvertisementList()}" var="o">

    			<h:column>
    				<!-- column header -->
    				<f:facet name="header">Id</f:facet>
    				<!-- row record -->
    				#{o.advertisement_id}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Title</f:facet>
    				#{o.title}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Content</f:facet>
    				#{o.content}
    			</h:column>
 
    			<h:column>
    				<f:facet name="header">Category</f:facet>
    				#{o.category.name}
    			</h:column>
    			
    			<h:column>
    				<f:facet name="header">Type</f:facet>
    				#{o.type.name}
    			</h:column>
    			
    			<h:column>
    				<f:facet name="header">Link</f:facet>
    				<h:commandLink value="LINK" action="result">
    					<f:setPropertyActionListener target="#{displayAdvertisementsBean.selectedAdvertisement}" value="#{o}" />
    				</h:commandLink>
    			</h:column>
 
    		</h:dataTable>
	</h:form>
	</body>
</html>